<!DOCTYPE html>
<html lang="en" xmlns:th="http://www.thymeleaf.org">
<head>
    <meta charset="UTF-8">
    <title>添加用户</title>
    <link rel="stylesheet" th:href="@{/css/bootstrap.min.css}">
</head>
<script th:src="@{/js/jquery-3.2.1.min.js}"></script>
<body>
<div class="container">
    <form id="formdata" onsubmit="return false">
        <div class="form-group">
            <label for="account">账号</label>
            <input type="text" class="form-control" name="account" id="account" placeholder="账号">
        </div>
        <div class="form-group">
            <label for="username">用户名</label>
            <input type="text" class="form-control" id="username" name="username" placeholder="用户名">
        </div>
        <div class="form-group">
            <label for="password">密码</label>
            <input type="password" class="form-control" id="password" name="password" placeholder="密码">
        </div>
        <div class="form-group">
            <label for="phone">手机号</label>
            <input type="text" class="form-control" id="phone" name="phone" placeholder="手机号">
        </div>
        <div class="form-group">
            <label for="email">邮箱</label>
            <input type="email" class="form-control" id="email" name="email" placeholder="邮箱">
        </div>
        <div class="form-group">
            <label class="radio-inline">
                <input type="radio" name="state" id="inlineRadio1" value="启用"> 启用
            </label>
            <label class="radio-inline">
                <input type="radio" name="state" id="inlineRadio2" value="禁用"> 禁用
            </label>
        </div>

        <div class="form-group">
            <label for="roleid">角色</label>
            <select name="roleid" id="roleid">
                <option value="2">用户</option>
            </select>
        </div>
        <button id="sub" class="btn btn-default">添加</button>
    </form>
</div>
</body>
<script>
    $(function () {
        $("#sub").click(function () {
            $.ajax({
                url:"/user/insertUser",
                type:"post",
                dataType:"json",
                data:$("#formdata").serialize(),
                success:function(data){
                    if(data.code==200){
                        alert("添加成功")
                    }
                }
            })
        })
    })
</script>
</html>